package com.zhiqianbao.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.zhiqianbao.R;
import com.zhiqianbao.entity.UserBank;
import com.zhiqianbao.entity.UserInfo;
import java.util.List;

/**
 * Created by liang on 2016/1/21.
 */
public class UseBindBankCardActivity extends BaseActivity implements View.OnClickListener {
    /**
     * 用户名称
     */
    TextView userName;
    /**
     * 汇款账号
     */
    TextView bankNum;
    /**
     * 输入金额
     */
    EditText editTextMoney;
    /**
     * 输入时间
     */
    EditText edit_text_time;
    /**
     * 提交按钮
     */
    Button buttonConfirm;

    UserBank userBank;
    UserInfo userInfo;




    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_use_bind_bank);
        init();
        initView();
    }

    private void initView() {
         userName=(TextView)findViewById(R.id.user_name);
         bankNum=(TextView)findViewById(R.id.bank_num);
         editTextMoney=(EditText)findViewById(R.id.edit_text_money);
         edit_text_time=(EditText)findViewById(R.id.edit_text_time);
         buttonConfirm=(Button)findViewById(R.id.button_confirm);
        //取出绑定的银行卡信息
        List<UserBank> userBanks = (List<UserBank>) UserBank.findWithQuery(UserBank.class, "select * from user_bank", new String[]{});
        //取出用户信息
        List<UserInfo> userInfos = (List<UserInfo>) UserInfo.findWithQuery(UserInfo.class, "select * from user_info", new String[]{});
        //远程获取数据
        if (userBanks.isEmpty()) {

        //
        } else {
            userBank = userBanks.get(0);
            userInfo = userInfos.get(0);

            userName.setText(userInfo.getName());
            bankNum.setText(userBank.getBankCard());
        }

    }

    @Override
    public void onClick(View v) {

    }
}
